<template>
  <div>
    <emap-flow-toolbar 
      ref="emapFlowToolbar"
      :defkey="defKey" 
      :taskid="taskId"
      :send-type="messageType" 
      :submitformdata="submitformdata"
      :flowcomment="flowComment"
      :onverify="onverify"
      :onquerysetting="onquerysetting"
      @fileexistverify="fileexistverify"
      @onbtnrender="onbtnrender"
      @action_complete="action_complete">
    </emap-flow-toolbar>
  </div>
</template>
<script>

const turing = window["tg-turing"]
// const contextPath = turing.utils.getContextPath()
const params = turing.utils.getUrlParam()

export default {
  data() {
    return {
        messageType: [], //催办类型
        isMuiltpart: false,  //转办
        nextAssignees: {},
        // formData: {},
        submitURL: window.submitURL,
    }
  },
  props: {
    datamodel: Array,
    defKey: String, 
    taskId: String,
    submitformdata: Object,
    gridAlias: String,
    formAlias: String,
    formRefDom: Object,
    onverify: Function,
    onquerysetting: Function,
    flowComment: [String,Object]
  },
  // mounted() {
  //   console.log('mounted ', this.submitformdata)
  // },
  methods: {
    /**
     * <转办命令> 是否存在文件上传进行二次校验
     */
    fileexistverify: function(item) {
      this.$emit("fileexistverify", item)
    },
    /**
     * emapFlowToolbar按钮动作数据
     */
    onbtnrender: function(btns) {
      // console.log(btns,"btns")
        var result = btns.map(function(btn) {
            btn.alias = params.alias;
            return btn
        });
        return result
    },
    action_complete: function(type, data) {
      this.$emit("action_complete", type, data)
    }
  },
  watch: {
    // submitformdata: {
    //     handler: function(newVal) {
    //         console.log('watch deep', newVal)
    //     },
    //     deep: true
    // }
  }
}
</script>
